<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAttributesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('attributes', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('category_id')->comment('属性所属分类，父分类的属性共享于所有子分类');
            $table->string('title', 60)->comment('属性名称');
            $table->tinyInteger('type')->comment('当添加商品时,该属性的添加类别; 1为手功输入;2为选择输入;3为多行文本输入');
            $table->string('value')->nullable()->comment('选择输入时的备选值，用|分割');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('attributes');
    }
}
